home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 3
/
Aminet 3 - July 1994.iso
/
Aminet
/
demo
/
euro
/
ShowAmiga.lha
/
ShowF+A2
< prev
next >
Wrap
Text File
|
1994-03-03
|
13KB
|
552 lines
'" ShowF+A, P. Kittel, CBM Ffm 10.2.94, 3.3.94
'" - Aufbauend auf LoadACBM
'" - Benötigt zu exec, graphics, dos,
'" - intuition und diskfont die .bmap-Dateien
CLEAR ,120000&
sc&=PEEKL(WINDOW(7) + 46) '" Screen-Struktur
Hoehe=PEEKW(sc&+14):PRINT '" Screen-Höhe
ymax%=255:IF Hoehe<ymax% THEN ymax%=199
yma5%=ymax%-5
ON BREAK GOSUB NoBreak
BREAK ON
ON ERROR GOTO Ende
MENU 1,0,0," "
MENU 2,0,0," "
MENU 3,0,0," "
MENU 4,0,0," "
'ON MENU GOTO 0
'MENU OFF
WINDOW 1," ",,0
DIM bPlane&(5), cTabWork%(32), cTabSave%(32)
'
REM - Functionen aus dos.library
DECLARE FUNCTION xOpen& LIBRARY
DECLARE FUNCTION xRead& LIBRARY
DECLARE FUNCTION xWrite& LIBRARY
DECLARE FUNCTION Lock& LIBRARY
REM - xClose returns no value
'
REM - Functionen aus exec.library
DECLARE FUNCTION AllocMem&() LIBRARY
DECLARE FUNCTION OpenLibrary&() LIBRARY
REM - FreeMem returns no value
'
DECLARE FUNCTION OpenDiskFont& LIBRARY
DECLARE FUNCTION AskSoftStyle& LIBRARY
DECLARE FUNCTION TextLength& LIBRARY
'
'"Suchen nach .bmap-Dateien ...
LIBRARY "diskfont.library"
LIBRARY "dos.library"
LIBRARY "exec.library"
LIBRARY "graphics.library"
LIBRARY "intuition.library"
REM - Pufferspeicherplatz reservieren
ClearPublic& = 65537&
mybufsize& = 360
mybuf& = AllocMem&(mybufsize&,ClearPublic&)
IF mybuf& = 0 THEN
loadError$ = "Pufferspeicherplatz nicht verfügbar."
GOTO Mcleanup2
END IF
bildnr%=2
ACBMname$ = "clogo.ACBM"
loadError$ = ""
GOSUB LoadACBM
IF loadError$<>"" THEN Mcleanup2
IF Hoehe<=200 THEN SCROLL (50,20)-(600,210),0,-28
rp&=sRastPort&
ma&=rp&+24:POKE ma&,1 ' Nur Farbe 1
OPEN "ram:locaf+a" FOR INPUT AS 1
LINE INPUT#1,unter$
LINE INPUT#1,haupt$
gu$=INPUT$(1,1)
CLOSE 1
OPEN "ram:allgf+a" FOR INPUT AS 1
n=0:zmax=0:z=0
WHILE NOT EOF(1)
LINE INPUT#1,a$
IF LEFT$(a$,1)="\" THEN
n=n+1
IF z>zmax THEN zmax=z
z=0
ELSE
z=z+1
END IF
WEND
CLOSE 1
n=n-1
' PRINT :PRINT n;"Einzelartikel, max.";zmax;"Zeilen"
DIM tit$(n),tex$(n,zmax),zei%(n),allg%(n),nun%(n),xuu%(6)
OPEN "ram:allgf+a" FOR INPUT AS 1
ni=0:z=-1:nu=-1
WHILE NOT EOF(1)
LINE INPUT#1,a$
IF LEFT$(a$,1)="\" THEN
zei%(ni)=z:allg%(ni)=RIGHT$(a$,1)="+"
IF MID$(a$,2,1)="#" THEN nu=nu+1:nun%(nu)=ni
ni=ni+1
z=-1
ELSE
z=z+1:tex$(ni,z)=a$
END IF
WEND
CLOSE 1
GOSUB Unterzeile
un=1
FOR i=0 TO 2
un=INSTR(un,unter$,"[")
xuu%(i+i)=(un-1)*8+xu%:un=un+1
un=INSTR(un,unter$,"]")
xuu%(i+i+1)=(un-1)*8+xu%:un=un+1
NEXT
ni=0:g$=""
WHILE 1
' CLS:LOCATE 2,1
SetAPen rp&,0
IF Hoehe>200 THEN
RectFill rp&,0,0,640,238
ELSE
RectFill rp&,0,0,640,182
END IF
IF pFont&<>0 THEN CALL CloseFont(pFont&)
enable%=AskSoftStyle&(rp&) ' WINDOW(8))
fontName$="topaz.font"
height%=9:style%=0:prefs%=0
fontName0$=fontName$+CHR$(0)
textAttr&(0)=SADD(fontName0$)
textAttr&(1)=height%*65536& + style%*256 + prefs%
pFont&=OpenDiskFont&(VARPTR(textAttr&(0)))
IF pFont& <> 0 THEN
SetFont rp&,pFont&
mask%=2
SetSoftStyle rp&,mask%,enable%
END IF
stadt$=tex$(ni,0)
ls%=LEN(stadt$)
sl%=TextLength&(rp&,SADD(stadt$),ls%)
x%=8
y%=18
Move rp&,x%,y%:SetDrMd rp&,8
SetAPen rp&,1:Text rp&,SADD(stadt$),ls%
IF pFont&<>0 THEN CALL CloseFont(pFont&)
enable%=AskSoftStyle&(rp&)
fontName$="topaz.font"
height%=8:style%=0:prefs%=0
fontName0$=fontName$+CHR$(0)
textAttr&(0)=SADD(fontName0$)
textAttr&(1)=height%*65536& + style%*256 + prefs%
pFont&=OpenDiskFont&(VARPTR(textAttr&(0)))
IF pFont& <> 0 THEN
SetFont rp&,pFont&
'mask%=2
'SetSoftStyle rp&,mask%,enable%
END IF
ze=zei%(ni):x%=8
FOR i=1 TO ze
' PRINT " ";tex$(ni,i)
y%=y%+9
stadt$=tex$(ni,i)
ls%=LEN(stadt$)
Move rp&,x%,y%
Text rp&,SADD(stadt$),ls%
NEXT
g$="":mo=0:wz=0:t0=TIMER+10+ze*5/2
SetAPen rp&,0
WHILE g$="" AND mo<=0
wz=wz+1:IF wz>7 THEN wz=1
IF wz=1 THEN RectFill rp&,0,0,640,8
IF wz=2 THEN RectFill rp&,0,0,5,ymax%
IF wz=3 THEN RectFill rp&,636,0,640,ymax%
IF wz=4 THEN RectFill rp&,0,yma5%,640,ymax%
IF wz=5 THEN RectFill rp&,635,0,640,10
IF wz=6 THEN ActivateWindow WINDOW(7)
IF wz=7 THEN ScreenToFront sScreen&
g$=INKEY$:mo=MOUSE(0)
IF TIMER>t0 THEN g$="auto"
IF TIMER<t0-1000 THEN t0=TIMER+10
WEND
IF mo THEN
xx%=MOUSE(1):yy%=MOUSE(2)
IF yy%>yu%-8 AND g$<>gu$ THEN
IF xx%>=xuu%(0) AND xx%<=xuu%(1) THEN g$=" "
IF xx%>=xuu%(2) AND xx%<=xuu%(3) THEN g$="-"
IF xx%>=xuu%(4) AND xx%<=xuu%(5) THEN g$=gu$
END IF
END IF
IF g$=CHR$(28) THEN g$="-"
IF g$=gu$ THEN GOSUB Uebersicht:g$=" "
IF g$="-" THEN
ni=ni-1:IF ni<0 THEN ni=n
ELSE
ni=ni+1:IF ni>n THEN ni=0
IF g$="auto" THEN
WHILE allg%(ni)=0
ni=ni+1:IF ni>n THEN ni=0
WEND
END IF
END IF
WEND
'
Mcleanup:
'
Mcleanup2:
IF loadError$ <> "" THEN PRINT loadError$:inf=0
'
Ende:
IF pFont& THEN CloseFont pFont&:pFont&=0
WINDOW CLOSE 2
SCREEN CLOSE 2
IF mybuf& <> 0 THEN CALL FreeMem&(mybuf&,mybufsize&)
LIBRARY CLOSE
END
LoadACBM:
'" - Folgende Variablen müssen
'" - initialisiert sein:
REM - ACBMname$ (ACBM-Dateiname)
REM - Variablen initialisieren
f$ = ACBMname$
fHandle& = 0
foundBMHD = 0
foundCMAP = 0
foundCAMG = 0
foundCCRT = 0
foundABIT = 0
REM - aus include/libraries/dos.h
REM - MODE_NEWFILE = 1006
REM - MODE_OLDFILE = 1005
filename$ = f$ + CHR$(0)
fHandle& = xOpen&(SADD(filename$),1005&)
IF fHandle& = 0 THEN
loadError$ = "Eingabedatei nicht gefunden/lesbar."
GOTO Lcleanup
END IF
inbuf& = mybuf&
cbuf& = mybuf& + 120
ctab& = mybuf& + 240
REM - Eingabe sollte lauten FORMnnnnACBM
rLen& = xRead&(fHandle&,inbuf&,12&)
tt$ = ""
FOR kk& = 8 TO 11
tt% = PEEK(inbuf& + kk&)
tt$ = tt$ + CHR$(tt%)
NEXT
IF tt$ <> "ACBM" THEN
loadError$ = "Keine ACBM-Grafikdatei."
GOTO Lcleanup
END IF
REM - ACBM-Datei Chunk-weise lesen
ChunkLoop:
REM - Chunk-Name/Länge ermitteln
rLen& = xRead&(fHandle&,inbuf&,8&)
icLen& = PEEKL(inbuf& + 4)
tt$ = ""
FOR kk& = 0 TO 3
tt% = PEEK(inbuf& + kk&)
tt$ = tt$ + CHR$(tt%)
NEXT
IF tt$ = "BMHD" THEN 'BitMap-Header
foundBMHD = 1
rLen& = xRead&(fHandle&,inbuf&,icLen&)
iWidth% = PEEKW(inbuf&)
iHeight% = PEEKW(inbuf& + 2)
iDepth% = PEEK(inbuf& + 8)
iCompr% = PEEK(inbuf& + 10)
scrWidth% = PEEKW(inbuf& + 16)
scrHeight% = PEEKW(inbuf& + 18)
iRowBytes% = iWidth% /8
scrRowBytes% = scrWidth% / 8
nColors% = 2^(iDepth%)
'" - Genug Platz für Videospeicher ?
AvailRam& = FRE(-1)
NeededRam& = ((scrWidth%/8)*scrHeight%*(iDepth%+1))+5000
IF AvailRam& < NeededRam& THEN
loadError$ = "Speicherplatz reicht nicht aus."
GOTO Lcleanup
END IF
kk& = 1
'" alte NTSC-Version:
'" IF scrWidth% > 320 THEN kk& = kk& + 1
'" IF scrHeight% > 200 THEN kk& = kk& + 2
'" neu PAL:
hires&=&H8000
lace&=&H4
IF foundCAMG THEN
IF (camgModes& AND hires&) THEN kk&=kk&+1
IF (camgModes& AND lace& ) THEN kk&=kk&+2
ELSE
IF scrWidth% > 320 THEN kk&=kk&+1
IF scrHeight% > 256 THEN kk&=kk&+2
END IF
SCREEN bildnr%,scrWidth%,scrHeight%,iDepth%,kk&
WINDOW bildnr%,,,0,bildnr%
REM - Adressen von Screen-Structures ermitteln
GOSUB GetScrAddrs
REM Farbpalette
IF foundCMAP THEN
CALL LoadRGB4&(sViewPort&,ctab&,nColors%)
END IF
REM - Schirm während Ladevorgang im Hintergrund
' ScreenToBack sScreen&
ELSEIF tt$ = "CMAP" THEN 'Farbpalette
foundCMAP = 1
rLen& = xRead&(fHandle&,cbuf&,icLen&)
REM - Farbpalette aufbauen
FOR kk& = 0 TO nColors% - 1
red% = PEEK(cbuf&+(kk&*3))
gre% = PEEK(cbuf&+(kk&*3)+1)
blu% = PEEK(cbuf&+(kk&*3)+2)
regTemp% = (red%*16)+(gre%)+(blu%/16)
POKEW (ctab&+(2*kk&)),regTemp%
NEXT
ELSEIF tt$ = "CAMG" THEN 'Amiga ViewPort Modes
foundCAMG = 1
rLen& = xRead&(fHandle&,inbuf&,icLen&)
camgModes& = PEEKL(inbuf&)
ELSEIF tt$ = "CCRT" THEN 'Graphicraft-Farbzyklus-Daten
foundCCRT = 1
rLen& = xRead&(fHandle&,inbuf&,icLen&)
ccrtDir% = PEEKW(inbuf&)
ccrtStart% = PEEK(inbuf& + 2)
ccrtEnd% = PEEK(inbuf& + 3)
ccrtSecs& = PEEKL(inbuf& + 4)
ccrtMics& = PEEKL(inbuf& + 8)
ELSEIF tt$ = "ABIT" THEN 'Contiguous BitMap
foundABIT = 1
'" - Hier werden nur volle BitMaps verarbeitet, keine
'" - Ausschnitte wie z.B. Pinsel (Brushes).
'" - Sehr schnell, liest ganze BitPlanes.
plSize& = (scrWidth%/8) * scrHeight%
FOR pp = 0 TO iDepth% -1
rLen& = xRead&(fHandle&,bPlane&(pp),plSize&)
NEXT
ELSE
REM - unbekannten Chunk-Typ lesen
FOR kk& = 1 TO icLen&
rLen& = xRead&(fHandle&,inbuf&,1&)
NEXT
'" - Wenn Länge ungerade, noch 1 Byte lesen
IF (icLen& OR 1) = icLen& THEN
rLen& = xRead&(fHandle&,inbuf&,1&)
END IF
END IF
REM - Fertig, wenn alle Chunks gelesen
IF foundBMHD AND foundCMAP AND foundABIT THEN
GOTO GoodLoad
END IF
REM - Lesen ok, nächsten Chunk lesen
IF rLen& > 0 THEN GOTO ChunkLoop
IF rLen& < 0 THEN ' Lesefehler
loadError$ = "Lesefehler."
GOTO Lcleanup
END IF
REM - rLen& = 0 heißt EOF (Dateiende)
IF (foundBMHD=0) OR (foundABIT=0) OR (foundCMAP=0) THEN
loadError$ = "Wichtige IFF-Chunks nicht gefunden."
GOTO Lcleanup
END IF
GoodLoad:
loadError$ =""
REM Farbpalette
IF foundCMAP THEN
CALL LoadRGB4&(sViewPort&,ctab&,nColors%)
END IF
Lcleanup:
IF fHandle& <> 0 THEN CALL xClose&(fHandle&)
RETURN
GetScrAddrs:
REM - Adressen von Screen-Structures ermitteln
sWindow& = WINDOW(7)
sScreen& = PEEKL(sWindow& + 46)
sViewPort& = sScreen& + 44
sRastPort& = sScreen& + 84
sColorMap& = PEEKL(sViewPort& + 4)
colorTab& = PEEKL(sColorMap& + 4)
sBitMap& = PEEKL(sRastPort& + 4)
REM - Screen-Parameter ermitteln
scrWidth% = PEEKW(sScreen& + 12)
scrHeight% = PEEKW(sScreen& + 14)
scrDepth% = PEEK(sBitMap& + 5)
nColors% = 2^scrDepth%
REM - Adressen der BitPlanes ermitteln
FOR kk& = 0 TO scrDepth% - 1
bPlane&(kk&) = PEEKL(sBitMap&+8+(kk&*4))
NEXT
RETURN
NoBreak:
RETURN
Uebersicht:
SetAPen rp&,0
RectFill rp&,0,0,640,ymax%
IF pFont&<>0 THEN CALL CloseFont(pFont&)
enable%=AskSoftStyle&(rp&) ' WINDOW(8))
fontName$="topaz.font"
height%=9:style%=0:prefs%=0
fontName0$=fontName$+CHR$(0)
textAttr&(0)=SADD(fontName0$)
textAttr&(1)=height%*65536& + style%*256 + prefs%
pFont&=OpenDiskFont&(VARPTR(textAttr&(0)))
IF pFont& <> 0 THEN
SetFont rp&,pFont&
mask%=2
SetSoftStyle rp&,mask%,enable%
END IF
'
SetAPen rp&,1
x%=8:y%=18
' haupt$="Übersicht - Hauptkapitel"
ls%=LEN(haupt$)
Move rp&,x%,y%
Text rp&,SADD(haupt$),ls%
x%=26:y%=29:nr%=-1
FOR i=0 TO nu
y%=y%+10
stadt$=tex$(nun%(i),0)
ls%=LEN(stadt$)
Move rp&,x%,y%+1
Text rp&,SADD(stadt$),ls%
Move rp&, 6,y%+2
Draw rp&,21,y%+2:Draw rp&,21,y%-6
Draw rp&, 6,y%-6:Draw rp&, 6,y%+2
IF nr%<0 AND nun%(i)>=ni THEN
RectFill rp&,6,y%-6,21,y%+2
nr%=i
END IF
NEXT
IF nr%<0 THEN
RectFill rp&,6,39-6,21,39+2
nr%=0
END IF
t0=TIMER+20:nux=-1:wz=0
SetAPen rp&,0
WHILE nux<0 AND TIMER<t0
wz=wz+1:IF wz>7 THEN wz=1
IF wz=1 THEN RectFill rp&,0,0,640,8
IF wz=2 THEN RectFill rp&,0,0,5,ymax%
IF wz=3 THEN RectFill rp&,636,0,640,ymax%
IF wz=4 THEN RectFill rp&,0,yma5%,640,ymax%
IF wz=5 THEN RectFill rp&,635,0,640,10
IF wz=6 THEN ActivateWindow WINDOW(7)
IF wz=7 THEN ScreenToFront sScreen&
u$=INKEY$
IF u$=CHR$(13) THEN nux=nr%
IF u$=CHR$(28) OR u$=CHR$(29) THEN
RectFill rp&,7,39+10*nr%-5,20,39+10*nr%+1
IF u$=CHR$(28) THEN
nr%=nr%-1:IF nr%<0 THEN nr%=nu
ELSE
nr%=nr%+1:IF nr%>nu THEN nr%=0
END IF
SetAPen rp&,1
RectFill rp&,6,39+10*nr%-6,21,39+10*nr%+2
SetAPen rp&,0
END IF
IF MOUSE(0) THEN
x%=MOUSE(1):y%=MOUSE(2)
IF x%<22 THEN
y%=y%-30
yh%=INT(y%/10)
ym%=y% MOD 10
IF ym%>1 AND y%>0 AND yh%<=nu THEN nux=yh%
END IF
END IF
WHILE MOUSE(0):WEND
WEND
IF nux>=0 THEN ni=nun%(nux)-1
RectFill rp&,0,0,640,ymax%
IF pFont&<>0 THEN CALL CloseFont(pFont&)
enable%=AskSoftStyle&(rp&)
fontName$="topaz.font"
height%=8:style%=0:prefs%=0
fontName0$=fontName$+CHR$(0)
textAttr&(0)=SADD(fontName0$)
textAttr&(1)=height%*65536& + style%*256 + prefs%
pFont&=OpenDiskFont&(VARPTR(textAttr&(0)))
IF pFont& <> 0 THEN
SetFont rp&,pFont&
'mask%=2
'SetSoftStyle rp&,mask%,enable%
END IF
' GOSUB Unterzeile
' RETURN
Unterzeile:
SetAPen rp&,1
xu%=8:yu%=ymax%-8
' unter$="[Weiter mit Leertaste oder Maus] [zurück mit Minus -] [u für Übersicht]"
ls%=LEN(unter$)
Move rp&,xu%,yu%
Text rp&,SADD(unter$),ls%
RETURN